//
//  DatabaseCreator.m
//  DoIT
//
//  Created by 葛欣 on 14/11/22.
//  Copyright (c) 2014年 gex. All rights reserved.
//

#import "DatabaseCreator.h"
#import "DbManager.h"

@implementation DatabaseCreator
+(void)initDatabase{
    NSString *key=@"IsCreatedDb";
    NSUserDefaults *defaults=[[NSUserDefaults alloc]init];
    if ([[defaults valueForKey:key] intValue]!=1) {
        [self createTodoTable];
        [defaults setValue:@1 forKey:key];
    }
}
+(void)createTodoTable{
    NSString *sql=@"CREATE TABLE IF NOT EXISTS todo(Id integer PRIMARY KEY AUTOINCREMENT,content text,status integer, creationTime datetime,modifyTime datetime)";
    [[DbManager sharedDbManager] executeNonQuery:sql withArgumentsInArray:nil];
}
@end
